<?php

function formRenderRow(sfFormField $widget) {
	$html = '<tr>';
	$html.= '<td class="label">'.$widget->renderLabel().'</td>';
	$html.= '<td class="widget">'.$widget->render().'</td>';
	$html.= '<td class="icon">';
	if($widget->hasError()) {
		$html.= '<img src="/images/16/delete2.png" alt="Fehler" />';
	}
	$html.= '</td>';
	$html.= '<td class="error">';
	if($widget->hasError()) {
		$html.= $widget->getError();
	}
	$html.= '</td>';
	$html.= '</tr>';
	return $html;
}

function formRenderRows($form, array $fields) {
	$html = '';
	foreach($fields as $field) {
		$html.= formRenderRow($form[$field]);
	}
	return $html;
}